Ext.onReady(function(){

	//================================================================
	// Set ExtJS proterty.
	//================================================================
	Ext.BLANK_IMAGE_URL = m_ContextName + '/common/ext-2.2/resources/images/default/s.gif';
	Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
	Ext.QuickTips.init();
	
	//================================================================
	// Set Layout using Ext Viewport
	//================================================================
	var viewport = new Ext.Viewport({
		layout: 'border',
		items: [
			gridTypeCount,
			new Ext.Panel({
				region: 'south',
				id: 'id_panel_result',
				margins: '0 0 0 0',
				border: false,
				height: 600,
				layout: 'border',
				items: [
					new Ext.TabPanel({
						region: 'north',
						id: 'id_tabpanel_type',
						activeTab: 0,
						height: 25,
						plain: true,
						defaults: {autoScroll: true},
						items: [{
							id: 'id_tab_type1',
							title: 'SQL Injection',
							html: '&nbsp;'
						},{
							id: 'id_tab_type2',
							title: 'XSS(Cross Site Scripting)',
							html: '&nbsp;'
						},{
							id: 'id_tab_type3',
							title: '파일 업로드',
							html: '&nbsp;'
						},{
							id: 'id_tab_type4',
							title: 'CSRF',
							html: '&nbsp;'
						}]
					}),
					gridTypeDetail
				]
			})
		]
	});
	
	
	//================================================================
	// Action Function
	//================================================================
	Ext.getCmp('id_tabpanel_type').on('tabchange', function(tabPanel, tab) {
		if (tab.id == 'id_tab_type1')
		{
			fnLoadTypeDetail('1');
		}	
		else if (tab.id == 'id_tab_type2')
		{
			fnLoadTypeDetail('2');
		}	
		else if (tab.id == 'id_tab_type3')
		{
			fnLoadTypeDetail('3');
		}	
		else
		{
			fnLoadTypeDetail('4');
		}
	});
	
	function fnLoadTypeDetail(strCode)
	{
		var objParam = {
				'file_no': m_FileNo,
				'detect_type': strCode
		}
		var jsonParam = Ext.util.JSON.encode(objParam);
		
		httpProxyTypeDetail.conn.url = m_ContextName + '/analysis/ajax_detect_type.json?params=' + jsonParam;
		storeTypeDetail.load();
	}
	
	function fnLoadTypeCount()
	{
		httpProxyTypeCount.conn.url = m_ContextName + '/analysis/ajax_detect_count.json?fileNo=' + m_FileNo;
		storeTypeCount.load();
	}
	
	
	//화면로드가 끝난 후 로딩.
	fnLoadTypeCount();
	fnLoadTypeDetail('1');
});

	
	

	
	
	
	
	
	
	
	
	
	
	